import 'dart:convert';
import 'dart:io';

// dart 中的http请求
void main() {
  (() async{
    var httpClient = HttpClient();
    var req = await httpClient.getUrl(Uri.parse("http://xzserver.applinzi.com/index"));
    var res = await req.close();
    var result;
    if (res.statusCode == HttpStatus.ok) {
      var json = await res.transform(utf8.decoder).join();
      result = jsonDecode(json);
    } else {
      result = "出错了";
    }
    
    // 遍历结果
    (result as List).forEach((element) => print(element));
  }());
}
